package top.doe.spark.rpc

import top.doe.spark.util.RpcAddress

case class RpcEndpointAddress(rpcAddress: RpcAddress, name: String) {

  def this(host: String, port: Int, name: String) = {
    this(RpcAddress(host, port), name)
  }

  override def toString: String = if(rpcAddress != null) {
    //远端的RpcEndpoint地址
    s"spark://$name@${rpcAddress.host}:${rpcAddress.host}"
  } else {
    //本地的RpcEndpoint地址
    s"spark-client://$name"
  }
}
